<template>
	<view class="price-detail">
		<common-list :isDataEmpty="tableData.length === 0" :status="status">
			<template #list>
				<view>
					<view class="list">
						<view class="item" v-for="(item, index) in tableData" :key="index">
							<view class="info">
								<view class="name">{{ item.type === 'AWARD' ? '租车奖励' : '提现' }}</view>
								<view class="date">{{ item.createTime }}</view>
							</view>
							<view class="num">+{{ item.brokerageMoney }}</view>
						</view>
					</view>
				</view>
			</template>
		</common-list>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	import {
		onLoad,
		onReachBottom,
		onPullDownRefresh,
	} from "@dcloudio/uni-app";
	import {
		doYjList
	} from '@/apis/user.js'
	import {
		userList
	} from '@/hooks/userList.js'
	import CommonList from '@/components/commonList/list.vue'

	/**
	 * 
	 * 列表数据
	 * */
	const getApi = async (params) => {
		const res = await doYjList(params)
		return res
	}
	const {
		tableData,
		status,
		fetchData,
		onBottom,
		onRefresh,
		queryForm
	} = userList({
		apis: {
			getApi
		},
		initForm: {}
	})

	onPullDownRefresh(() => {
		onRefresh()
	})
	onReachBottom(() => {
		onBottom()
	})

	onLoad(async () => {
		onRefresh()
	})
</script>

<style lang="scss" scoped>
	.price-detail {
		padding: 24rpx;

		.list {
			.item {
				padding: 28rpx 0;
				border-bottom: 1rpx solid #EEEEEE;
				display: flex;
				align-items: center;
				justify-content: space-between;

				&:not(:first-child) {
					margin-top: 40rpx;
				}

				.info {
					.name {
						font-size: 30rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #333333;
					}

					.date {
						margin-top: 8rpx;
						font-size: 24rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #999999;
					}
				}

				.num {
					font-size: 32rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #333333;
				}
			}
		}
	}
</style>